package com.fxkj.cloud.drms.application.handler;

import com.fxkj.cloud.drms.domain.linkage.LinkageProcessorService;
import com.fxkj.cloud.drms.domain.linkage.event.SceneLinkageExecuteEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * <p>description: </p>
 * @author ww
 * @date 2025/4/2 17:40
 */
@Component
public class SceneLinkageHandler {

    private final Logger log = LoggerFactory.getLogger(SceneLinkageHandler.class);
    private final LinkageProcessorService linkageProcessorService;

    public SceneLinkageHandler(LinkageProcessorService linkageProcessorService) {
        this.linkageProcessorService = linkageProcessorService;
    }

    @EventListener
    public void handlerSceneLinkageExecuteEvent(SceneLinkageExecuteEvent event) {
        log.trace("捕获到场景联动执行事件");
        linkageProcessorService.sceneLinkageExecute(event.getSceneLinkageId(), event.getTsKvEntries());
    }
}
